﻿<%@ Page Language="C#" MasterPageFile="~/Master.Master"  Title="Créer votre compte" CodeBehind="FailedRegister.aspx.cs" %>

<script runat="server">

    protected void ButtonEnregistrer_Click(object sender, EventArgs e)
    {
        string nom = Convert.ToString(TextBoxNom.Text);
        string prenom = Convert.ToString(TextBoxPrenom.Text);
        string email = Convert.ToString(TextBoxEmail.Text);
        string passwd = Convert.ToString(TextBoxPassword.Text);
        bool estadmin = false;
        bool testemail = INSTA.MusiqueStore.DAL.TestEmail.ValidationEmail(email);
        if (nom != "" && prenom != "" && email != "" && passwd != "")
        {
            if (testemail == true)
            {
                ///Insertion des données puis retourner la page connection
                INSTA.MusiqueStore.DAL.AddCustomer.addCustomer(nom, prenom, email, passwd, estadmin);
                Response.Redirect("~/Account/SuccessRegister.aspx", true);
            }
            else
            {
                Response.Redirect("~/Account/FailedRegister.aspx", true);
            }

        }
        else
        {
            Response.Redirect("~/Account/FailedRegister.aspx", true);     
        }
    }
</script>

<asp:Content ID="Content1" runat="server" contentplaceholderid="MainContent">
    <div class="divContenu">
    <div class="accountHeader">
    <h2 class="auto-style2">
        Merci de remplir le formulaire.</h2>
        <h2>
        S'inscrire</h2>
       <br />
      
        <table style="width:100%;">
            <tr>
                
                <td>
      
      <dx:ASPxLabel ID="LabelEmail" runat="server" Text="Nom"/>
      <dx:ASPxTextBox ID="TextBoxNom" runat="server" Width=80% style="text-align: center" >
      </dx:ASPxTextBox>
                </td>
                <td>
      
      <dx:ASPxLabel ID="LabelEmail0" runat="server" Text="Prénom"/>
      <dx:ASPxTextBox ID="TextBoxPrenom" runat="server" Width=80% >
      </dx:ASPxTextBox>
                </td>
            </tr>
            <tr>
               
                <td>
      
      <dx:ASPxLabel ID="LabelEmail1" runat="server" Text="Email"/>
      <dx:ASPxTextBox ID="TextBoxEmail" runat="server" Width=80% style="text-align: center" >
      </dx:ASPxTextBox>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBoxEmail"
                      Display="Dynamic" ValidationGroup="newUser"
                      ErrorMessage="Email invalide veuillez vérifier la saisie de votre e-mail" 
                       ValidationExpression="^[a-zA-Z0-9-+.'_]+@\w+([-.]\w+)*\.\w+([-.]\w+)*$" Width="80%" />
                </td>
                <td>
      
      <dx:ASPxLabel ID="LabelEmail2" runat="server" Text="Mot de passe"/>
      <dx:ASPxTextBox ID="TextBoxPassword" runat="server" Width=80% style="text-align: center" Password="True" >
      </dx:ASPxTextBox>
                </td>
            </tr>
            <tr><td></td><td></td></tr>
            <tr>
                <td>
                    <br/>
                    <dx:ASPxButton ID="ButtonEnregistrer" runat="server" Text="Enregistrer" OnClick="ButtonEnregistrer_Click">
                    </dx:ASPxButton>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
        </table>
      <br />
      <br />
      <br /><br />
      

      
    </div>
        </div>
</asp:Content>


    



